from elasticsearch import Elasticsearch
class Es:
    def __init__(self,name,type):
        self.es=Elasticsearch(hosts='localhost')
        self.name=name
        self.type=type
    # 插入数据
    def insert(self,data):
        self.es.index(index=self.name,doc_type=self.type,body=data)
    # 查询
    def find(self,data):
        self.es.search(index=self.name,body=data)














